export default {
	template: `
		<h1>商品信息</h1>
		<div>
			商品编号:{{id}}
			商品名称:{{name}}
		</div>
	`,
	data() {
		return {
			id: 1,
			name: "商品信息",
			goods: {
				1: "小米手机18",
				2: "华为手机Mate60"
			}
		}
	},
	created() {
		console.log("商品详情 created() 组件创建了");
		console.log("路由传递过来的信息:")
		console.log(this.$route)
		console.log("路由传递过来的信息: ?id=1")
		console.log(this.$route.query)
		console.log("路由传递过来的信息: /1")
		console.log(this.$route.params)
		console.log(this.$route.params.id)
		this.id = this.$route.query.id
		this.name = this.goods[this.id]
	}
}
